package com.xiaotao.controller;

import com.nimbusds.jose.JOSEException;
import com.xiaotao.common.User;
import com.xiaotao.service.UserService;
import com.xiaotao.utils.ResponseUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    private UserService userService;
    @PostMapping("/login")
    public ResponseUtil login(@RequestBody User user) throws JOSEException {
        return userService.login(user.getUsername(),user.getPassword());
    }
}
